<!doctype html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>添加书籍</title>

    <!-- Required meta tags -->

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

    <nav class="navbar navbar-expand-lg navbar-dark text-white">
        <a class="navbar-brand" href="#">商城</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav mr-auto">
                <li class="nav-item active">
                    <a class="nav-link" th:href="@{/}">首页 <span class="sr-only">(current)</span></a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" th:href="@{/all}">商品大全</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" th:href="@{/category}">分类</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" th:href="@{/allorder}">您的书库</a>
                </li>



            </ul>
            <form class="form-inline my-2 my-lg-0" action="/search" method="post">
                <input class="form-control mr-sm-2" type="search" placeholder="Search" name="text" aria-label="Search">
                <button class="btn btn-outline-success my-2 my-sm-0" type="submit">搜索</button>
            </form>
        </div>
    </nav>

</head>
<body background="images/bg2.jpg" style="
background-repeat:no-repeat ;
background-size:100% 100%;
background-attachment: fixed;">


    <div class="container">
        <div class="jumbotron">

        <div class="row">
            <div class="col-sm">

            </div>
            <div class="col-sm">
                <div class="list-group">
                    <tr th:each="book: ${books}">
                        <button type="button" class="list-group-item list-group-item-action" data-toggle="modal" th:data-target="'#'+${book.getID()}"><td th:text="${book.getTitle()}">Onions</td></button>

                        <div class="modal fade" th:id="${book.getID()}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                            <div class="modal-dialog" role="document">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <h5 class="modal-title" ><td th:text="${book.getTitle()}">Onions</td></h5>
                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                            <span aria-hidden="true">&times;</span>
                                        </button>
                                    </div>
                                    <div class="modal-body">
                                        <td th:text="${book.getAuthor()}">Onions</td><br>
                                        <td th:text="${book.getNation()}">Onions</td><br>
                                        <td th:text="${book.getType()}">Onions</td><br>
                                        <td th:text="${book.getPress()}">Onions</td><br>
                                        <td th:text="${book.getBrief()}">Onions</td>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                                        <a  th:href="@{/deletebook?id={id}(id=${book.getID()})}" class="btn btn-primary">删除</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </tr>

                </div>
                <br><br>

                <!-- Button trigger modal -->
                <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
                    添加新书
                </button>

                <!-- Modal -->
                <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <h5 class="modal-title" id="exampleModalLabel">添加新书</h5>
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                    <span aria-hidden="true">&times;</span>
                                </button>
                            </div>

                            <form action="/addbook" method="post">
                                <div class="modal-body">

                                    <div class="form-group">
                                        <label for="inputAddress">书名</label>
                                        <input type="text" class="form-control" id="inputAddress" name="title" placeholder="不需要书名号">
                                    </div>
                                    <div class="form-group">
                                        <label for="inputAddress">作者名</label>
                                        <input type="text" class="form-control" id="inputAddress2" name="author" placeholder="作者名">
                                    </div>
                                    <div class="form-group">
                                        <label for="inputAddress">作者国籍</label>
                                        <input type="text" class="form-control" id="inputAddress22" name="nation" placeholder="作者国籍">
                                    </div>
                                    <div class="form-group">
                                        <label for="inputAddress">书的原名</label>
                                        <input type="text" class="form-control" id="inputAddress3" name="originaltitle" placeholder=" ">
                                    </div>
                                    <div class="form-group">
                                        <label for="inputAddress">出版社</label>
                                        <input type="text" class="form-control" id="inputAddress4" name="press" placeholder="出版社">
                                    </div>
                                    <div class="form-group">
                                        <label for="inputAddress">页码</label>
                                        <input type="text" class="form-control" id="inputAddress5" name="pages" placeholder="页码">
                                    </div>
                                    <div class="form-group">
                                        <label for="inputAddress">价钱</label>
                                        <input type="text" class="form-control" id="inputAddress6" name="price" placeholder="价钱">
                                    </div>
                                    <div class="form-group">
                                        <label for="exampleFormControlSelect2">书的类型</label>
                                        <select multiple class="form-control" id="exampleFormControlSelect2" name="type">
                                            <option>文学</option>
                                            <option>历史</option>
                                            <option>科幻</option>
                                            <option>推理</option>
                                        </select>
                                    </div>

                                    <div class="form-group">
                                        <label for="exampleFormControlTextarea1">书的简介</label>
                                        <textarea class="form-control" id="exampleFormControlTextarea1" name="brief" rows="3"></textarea>
                                    </div>

                                    <div class="modal-footer">
                                        <button type="submit" class="btn btn-primary">Submit</button>
                                    </div>

                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm">

            </div>
        </div>
    </div>




</div>


<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>



</body>
</html>